import { INCREMENT, DECREMENT } from "../../actions/couter/varuable";

const defaultState = {
    count: 0,
};

const reducer = (state = defaultState, action) => {
    const { type, payload } = action;
    switch (type) {
        case INCREMENT:
            return {
                ...state,
                count: state.count + payload * 1,
            };
        case DECREMENT:
            return {
                ...state,
                count: state.count - payload * 1,
            };
        default:
            return state;
    }
};

export default reducer;
